public class Test {
    public static void main() {
        // for 循环
        int count = 0;
        for (int i = 0; i < 5; i++) {
            if (i == 2) {
                continue; // 跳过当前迭代
            }
            if (i == 4) {
                break; // 提前退出循环
            }
            count++;
        }
        System.out.println("For loop count: " + count);

        // foreach 循环
        int[] numbers = { 1, 2, 3, 4, 5 };
        for (int num : numbers) {
            System.out.println("Number: " + num);
        }

        // for 标签化
        int count2 = 0;
        outer: for (int i = 0; i < 5; i++) {
            count2++;
            for (int j = 0; j < 4; j++) {
                if (count2 == 2) {
                    continue outer; // 跳过外层循环的当前迭代
                }
                if (count2 == 4) {
                    break outer; // 提前退出外层循环
                }
                System.out.println("Nested For loop count2: " + count2);
            }
        }
    }
}